<!DOCTYPE html>
<html>
{include file="head.html"}
<body>
<div class="header" >
     <a class="left-btn pointer" href="{$appkoudai}"><span class="iconfont icon-back"></span></a>
    <div class="title">口袋对账</div>
    <a class="right-btn pointer" href="{$appkoudai}?m=koudai_dz&a=order"><span class="iconfont icon-search"></span></a>
     
  </div>
  {include file="koudai_dz/nav.html"}
 {get data=status_list model=koudai_dz fun=status_list()}
    <div class="uclist"> {foreach item=c from=$data}
      <div class="item">
        <div class="hd"> {$status_list[$c.status]}   <span class="right">结算：￥{$c.money}元</span></div>
        <div>{$c.dateline|date:Y-m-d H:i:s} <span class="right">订单金额:{$c[order][money]}</span></div>
        <div  >
        	<table  class="table">
            <tr>
            	<td>名称</td> 
                <td>价格</td> 
                <td>数量</td> 
                <td>挂账</td> 
                <td>退货</td> 
                <td>结算</td> 
              </tr>
        	{foreach item=p from=$c.products}
            <tr>
            	<td>{$p.title}</td> 
                <td>{$p.price}</td> 
                <td>{$p.amount}</td> 
                <td>{$p.gznum}</td> 
                <td>{$p.thnum}</td> 
                <td>{$p.jsnum}</td> 
              </tr>
            {/foreach}
            </table>
            <div class="tools">
            {if $c.status eq 1}
            <a href="{$appkoudai}?m=koudai_dz&a=confirm&id={$c.id}">确认对账</a>
            {/if}
            
            
            </div>
             {if $c.status eq 2}
             <div class="row">
           
            <div class="col-3-2">
            	<div >
                	<label>退货至</label>
                    <select class="k" style=" margin-left:60px;">
                    <option value="1">口袋店</option>
                    <option value="2">夜猫店</option>
                    </select>
            </div>
            </div>
            <div class="col-3-1">
             <button class="btn btn-row thsubmit" did="{$c.id}" orderid="{$c.order_id}">确认</button>
            </div>
            </div>
            {/if}
            
        </div>
      </div>
      {/foreach} </div>
    <div>{$pagelist}</div>
    
     
  {assign var="botnav" value="koudai_dz"}
  {include file="footer.html"} 
  <script>
  $(function(){
	 $(".thsubmit").on("click",function(data){
		var obj=$(this);
		$.get("{$appkoudai}?m=koudai_dz&a=thshop&ajax=1",{
			order_id:$(this).attr("orderid"),
			id:$(this).attr("did"),
			k:obj.parents(".row").find(".k").val()
		},function(data){
			if(data.error){
				skyToast(data.message);
			}else{
				skyToast(data.message);
			}
		},"json");
	 });
  });
  </script>
</body>
</html>